package com.ns.core.project;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.ns.core.mapper.IMapper;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 公共 Mapper 与 公共 Service
 *
 * @author lw
 */
@Component
@RequiredArgsConstructor
public class MapperService {


    /**
     * 公共Mapper
     */
    public static IMapper publicMapper;
    /**
     * 公共Service
     */
    public static ServiceImpl publicService;

    /**
     * json序列化对象
     */
    public static ObjectMapper objectMapper;

    // 注入
    @Autowired
    public void setBean(
            IMapper publicMapper,
            ServiceImpl publicService,
            ObjectMapper objectMapper
    ) {
        MapperService.publicMapper = publicMapper;
        MapperService.publicService = publicService;
        MapperService.objectMapper = objectMapper;
    }
}
